import dotenv from "dotenv"
import { join } from "path";

// 在主程序引导前，先获取配置文件
export const bootstrapBefore = (): object=>{
    let result;

    // nodejs中环境变量判断
    if (process.env.ENV === 'development') {
        result = dotenv.config({path: join(__dirname, "../.env")})
        console.log("===== .env loaded.")
    } else {
        result = dotenv.config({path: join(__dirname, "../.env.prodction")})
        console.log("===== .env.production loaded.")
    }

    return result.parsed;
}

